package task3;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * @author Administrator
 * 通过字节缓冲流  把当前目录的a.txt拷贝到c盘根目录
 */
public class CopyFile {
    public static void main(String[] args) throws Exception{
        BufferedInputStream bod=new BufferedInputStream(new FileInputStream("a.txt"));
        BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream("C:\\a.txt"));
        byte[] bys=new byte[1024];
        int len=0;
        while ((len=bod.read(bys))!=-1){
            bos.write(bys,0,len);
        }
        bod.close();
        bos.close();
    }
}
